
function run(){
	var time = 20000; 
	setInterval("makeordernumber()",time);
}

$(function(){
    if(undefined != error_message&&error_message!="")
    {
        $.gritter.add({
            title: '提示',
            text: error_message,
            class_name: 'gritter-error'
        });

    }
    if(undefined != success_message&&success_message!="")
    {
        $.gritter.add({
            title: '提示',
            text: success_message,
            class_name: 'gritter-success'
        });

    }
	$.ajaxSetup({
		headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
	});
    $("body").ajaxStart(function(){

        if($("#hidden").length<=0){
            $("body").append("<div style='display:block;position:absolute;top:50%;left:50%;z-index:999;'"+
                "id='hidden' width='100px' height='100px' align='center'><div class='icon-spinner icon-spin orange bigger-170' width='90px' height='90px'></div><div algin='center' style='filter: alpha(opacity=50);opacity: .5;'>"+
                "<p>页面加载中。。。</p></div></div>");
            return;
        }
        $("#hidden").attr("style","display:block;position:absolute;top:50%;left:50%;z-index:999;width:120px;height:30px;align:center;");
    });
    $("body").ajaxComplete(function(){
        $("#hidden").attr("style","display:none;position:absolute;top:50%;left:50%;background-color:#FFF8DC;z-index:999;width:120px;height:30px;align:center;");
    });
	//makeordernumber();
	//run();
	

});

function makeordernumber(){
	$("#makenumber").text("");
    $.get("/backstage/order/getmakeordercount",
		function(re){
			if(re.result>10&&re.result<100){
				re.result -= re.result%10;
				$("#makenumber").text(re.result+"+");
			}else if(re.result>100&&re.result<1000){
				re.result -= re.result%100;
				$("#makenumber").text(re.result+"+");
			}else if(re.result>=1000){
				re.result = "more";
				$("#makenumber").text(re.result+"+");
			}else{
				$("#makenumber").text(re.result+"+");
			}
			if(re.result>0){
				$("#countall").text("New");
			}else{
				$("#countall").text("");
			}
        }
    );
}
function showMessage(error_message,success_message){
    if(undefined != error_message&&error_message!="")
    {
        $.gritter.add({
            title: '提示',
            text: error_message,
            class_name: 'gritter-error'
        });

    }
    if(undefined != success_message&&success_message!="")
    {
        $.gritter.add({
            title: '提示',
            text: success_message,
            class_name: 'gritter-success'
        });

    }
}